function [F] = computerEssentialErrorSVD(MYF,K1,K1T)
%this function , given a camera center and a focal length and a fundamental
%matrix computes the error with respect to a fundamental matrix

%shape of x is
% x(1,1) focal length
% x(1,2) optical center x coordinate
% x(1,3) optical center y coordinate
% x(1,4) aspect ratio,  OPTINAL
% x(1,5) skew,  OPTINAL

if(isempty(MYF)==1)
   F=0;
   return;
end

G=(K1T)*MYF*K1;

try
    S = svd(G);
  %D=eig(G'*G);
   % S=[D(2,1) ; D(3,1) ; 0];
catch
    S= [ 100 ;  10 ;  5];
end

if( S(2,1)>eps)
    F=(((S(1,1)-S(2,1))/S(2,1))); % should not be squared but all my thresholds are based on this being squared
  %  F=(((S(1,1)-S(2,1))/S(2,1))); % should not be squared but all my thresholds are based on this being squared
else
    
    F=100;
end

% 
% threshold=0.05;
% if(F <threshold)
%     WEIGHT=(1-((F/threshold)^2))^2;
% elseif(F >=threshold )
%     WEIGHT=0 ;
% else
%     disp(['what happened']);
% end
% 
% F=F*WEIGHT;

end
